/**
 * Created by rensq on 2017/10/25.
 */
public class Test {

    public static void main(String[] args) {
        testQF();
    }

    public static void testQF(){
        QuickFindQF qf = new QuickFindQF(10);
        qf.union(1,2);
        qf.union(3,4);
        qf.union(5,6);
        qf.union(7,2);
        qf.union(8,3);
        qf.union(9,4);
        qf.union(5,0);


        System.out.println(qf.connected(2,6));
        System.out.println(qf.connected(5,4));
        System.out.println(qf.connected(0,9));
        System.out.println(qf.connected(0,9));
        System.out.println("-------------------------");
        System.out.println(qf.connected(0,6));
        System.out.println(qf.connected(3,9));
        System.out.println(qf.connected(1,7));
    }
}
